package interface_test.usb;

import interface_test.sharp.C;

import java.security.Key;

/**
 * @author yuisama
 * @date 2022/04/28 21:11
 **/
public class Computer{
    public static void main(String[] args) {
        Computer computer = new Computer();
        Mouse mouse = new Mouse();
        // 插入鼠标 ok
        computer.fun(mouse);
        KeyBoard keyBoard = new KeyBoard();
        // 插入键盘 ok
        computer.fun(keyBoard);
        Camera camera = new Camera();
        computer.fun(camera);
    }
    // 此时为何方法的参数用的是USB接口引用？
    // fun方法就模拟咱电脑的USB的插口
    // 假设咱们fun方法参数Mouse会咋样？
    public void fun(USB usb) {
        usb.plugIn();
        usb.work();
    }
}